<?php

/**
 * @author huuvung
 * @copyright 2012
 */
 
defined('DSVH') or die('Restricted access');

//add 
function insertlienketweb($local){
    mysql_query("insert lien_ket_web set 
    ten_lien_ket_web = '".$local['ten_lien_ket_web']."',
    link = '".$local['link']."'
    ", 
    dbconnect());
}
//list 
function getListlienketweb($start, $limit)
    {
        $local_list = mysql_query("SELECT * FROM lien_ket_web
        limit ".(int)$start.",".(int)$limit."
        ", dbconnect());
        $result = array();
        while ($local = mysql_fetch_array($local_list)){
            $result []= $local;
        }
        return $result;
    }
    
function totallkw(){
   $result = mysql_query("select * from lien_ket_web",dbconnect());
    return mysql_num_rows($result);
}   

//ham lay du lieu 
function getlienketweb($id)
    {
    $pro = mysql_query("select * from lien_ket_web where lien_ket_web_id = '".(int)$id."'", dbconnect());
    return mysql_fetch_array($pro);
    }
//cap nhat 
function editlienketweb($id, $local)
{
    mysql_query("update lien_ket_web set ten_lien_ket_web ='".$local['ten_lien_ket_web']."',
    link = '".$local['link']."'
    where lien_ket_web_id = '".(int)$id."'", dbconnect());
}
// xoa 
function dellienketweb($id){
    mysql_query("delete from lien_ket_web where lien_ket_web_id ='".(int)$id."'", dbconnect());
}

?>